<?php
class ControllerErrorNotFound extends Controller
{
    public function index()
    {
        $this->load->language('error/not_found');

        
        $this->load->model('design/layout');
        $layoutId = $this->model_design_layout->getLayout($this->request->get['route']);
        $layoutName = $this->model_design_layout->getLayoutName($layoutId);
        
      

        
        
        if (!$layoutId) {
            $this->document->setTitle($this->language->get('heading_title'));
        } else {
            $this->document->setTitle($layoutName);
        }
        
      

        $data['breadcrumbs'] = array();

        $data['breadcrumbs'][] = array(
            'text' => $this->language->get('text_home'),
            'href' => $this->url->link('common/home')
        );

        
        
        if (isset($this->request->get['route']) && $layoutId) {
            $data['breadcrumbs'][] = array(
            'text' => $layoutName,
            'href' => $this->url->link($this->request->get['route'])
          );
        }
        if (isset($this->request->get['route']) && !$layoutId) {
            $url_data = $this->request->get;

            unset($url_data['_route_']);

            $route = $url_data['route'];

            unset($url_data['route']);

            $url = '';

            if ($url_data) {
                $url = '&' . urldecode(http_build_query($url_data, '', '&'));
            }

            $data['breadcrumbs'][] = array(
                'text' => $this->language->get('heading_title'),
                'href' => $this->url->link($route, $url, $this->request->server['HTTPS'])
            );
        }

        
        
        if (!$layoutId) {
            $data['heading_title'] = $this->language->get('heading_title');
        } else {
            $data['heading_title'] = '';//$layoutName;
        }
        
      

        
        
        if (!$layoutId) {
            $data['text_error'] = $this->language->get('text_error');
        } else {
            $data['text_error'] = '';
        }
        
      

        $data['button_continue'] = $this->language->get('button_continue');

        $data['continue'] = $this->url->link('common/home');

        $data['column_left'] = $this->load->controller('common/column_left');
        $data['column_right'] = $this->load->controller('common/column_right');
        $data['content_top'] = $this->load->controller('common/content_top');
        $data['content_bottom'] = $this->load->controller('common/content_bottom');
        $data['footer'] = $this->load->controller('common/footer');
        $data['header'] = $this->load->controller('common/header');

        
        
        if (!$layoutId) {
            $this->response->addHeader($this->request->server['SERVER_PROTOCOL'] . ' 404 Not Found');
        }
        
      

        $this->response->setOutput($this->load->view('error/not_found', $data));
    }
}
